<%-- 
    Document   : show_account_statement
    Created on : Sep 20, 2012, 4:33:18 PM
    Author     : faizal.azlee
--%>

<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Pindahan Simpanan</title>
        <script type="text/javascript">
            $(document).ready(function(){
                $('form').submit( function () {
                    return formValidation();
                }); 
                
                $('#noAkaunDari').change(function(){                    
                    var url = '${pageContext.request.contextPath}/deposit?getNoKP' ;
                    $.get(url, 
                    {
                        noAkaun:$(this).val()
                    }, 
                    function(data){
                        $('#noKpDari').val(data);
                    }, "text");
                });
                
                 if(typeof String.prototype.trim !== 'function') {
                    String.prototype.trim = function() {
                      return this.replace(/^\s+|\s+$/g, ''); 
                    }
                  }
                  
                  
                $('.favTrx').hide();
                $('.normalTrxn').show();
                $('#jenisPindahan').change(function(){ 
                    var jenisAkaun = $(this).val();
                    if(jenisAkaun == '22'){
                        $('.normalTrx').hide();
                        $('.favTrxn').show(); 
                    }else if(jenisAkaun == '33'){
                        $('.favTrxn').hide();
                        $('.normalTrx').show();
                    }                                      
                }); 
            
            });
            

            
            function validate(f)
            {
                var patt=new RegExp("^([0-9]+)(.{0,1})([0-9]{0,2})$");
                var m = patt.test(document.getElementById("damaun").value);
                if(document.getElementById("noAkaunPenerima").value.trim().length!=15)
                {                    
                    alert("Sila masukkan No Akaun yang sah");
                    return false;
                }else if(document.getElementById("noKpDari").value.trim().length<1)
                {                    
                    alert("Sila masukkan No. KP Semasa yang sah");
                    return false;
                }else if(!m)
                {
                    alert("Sila masukkan amaun yang sah");                    
                    return false;
                }else if(document.getElementById("noAkaunDari").value==document.getElementById("noAkaunPenerima").value)
                {
                    alert("No akaun penerima adalah sama");
                    return false;
                }else{
                    blockUI();
                    f.action="${pageContext.request.contextPath}/deposit/transfer?Transfer_Step2";
                    f.submit();
                }   
            }            
            
            function resetAll()
            {
                document.getElementById("noAkaunDari").value="";
                document.getElementById("noKpDari").value="";
                document.getElementById("noAkaunPenerima").value="";
                document.getElementById("damaun").value="";
            }
            
            function goBack()
            {
                 window.location.href="<%= request.getContextPath() %>/deposit/transfer/response?Transfer_Step1";
            }
        </script>
    </head>
    <body>
        <s:errors/>
        <s:messages/>
        <s:form action="/deposit/transfer" class="niceform">
            <s:hidden name="deposit.noKp" id="noKp"></s:hidden> 
            <s:hidden name="deposit.noAkaun" id="noAkaun"></s:hidden>
            <div id="content">
                <div id="logo">
                    <span>
                        <img src="${pageContext.request.contextPath}/images/img/ribbon.png"/>               
                    </span>
                </div>
                <h3>
                    Pindahan Simpanan
                </h3>
                    
                <!-- add in 23092014-->
                
            
                <!-- -->
                <p>
                    <label><font color="red">*</font>Dari Akaun TH :</label>
                    <s:select name="deposit.noAkaunDari" class="required" id="noAkaunDari">
                        <s:option value="">Sila Pilih</s:option>
                        <c:forEach items="${actionBean.accountList}" var="item">
                            <s:option value="${item.akaunTmbhn}">${item.akaunTmbhn}</s:option>
                        </c:forEach>
                    </s:select>
                </p>
                <p>
                    <label><font color="red">*</font>No. KP Semasa :</label>
                    <s:text name="deposit.noKpDari" disabled="false" id="noKpDari" readonly="readonly"/>
                </p> 
                <p>
                    <label><font color="red">*</font>Ke Akaun :</label><s:text name="deposit.noAkaunPenerima" id="noAkaunPenerima"/>
                </p>
               
                <p>
                    <label><font color="red">*</font>Jumlah (RM) :</label><s:text name="deposit.amaun" id="damaun"/>
                </p>  
                 <p>
                        <label>&nbsp;</label>
                        <font size="2">Ruangan mandatori bertanda <font color="red">*</font> adalah wajib diisi.</font>
                </p>
                <p align="center">
                    <s:button name="Step2" value="Seterusnya" class="button green" onclick="validate(this.form)"/>
                    <s:button name="reset" value="Isi Semula" onclick="resetAll();" class="button green"/>
                    <s:button name="back" value="Kembali" class="button green" onclick="goBack()"/>
                </p>
                
            </div>
        </s:form>
    </body>
</html>
